<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GtkGLArea: GTK+ 3 Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
<link rel="home" href="index.html" title="GTK+ 3 Reference Manual">
<link rel="up" href="MiscObjects.html" title="Miscellaneous">
<link rel="prev" href="GtkDrawingArea.html" title="GtkDrawingArea">
<link rel="next" href="GtkEventBox.html" title="GtkEventBox">
<meta name="generator" content="GTK-Doc V1.33.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
                  <a href="#GtkGLArea.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
                  <a href="#GtkGLArea.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_interfaces">  <span class="dim">|</span> 
                  <a href="#GtkGLArea.implemented-interfaces" class="shortcut">Implemented Interfaces</a></span><span id="nav_properties">  <span class="dim">|</span> 
                  <a href="#GtkGLArea.properties" class="shortcut">Properties</a></span><span id="nav_signals">  <span class="dim">|</span> 
                  <a href="#GtkGLArea.signals" class="shortcut">Signals</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="MiscObjects.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="GtkDrawingArea.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="GtkEventBox.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="GtkGLArea"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="GtkGLArea.top_of_page"></a>GtkGLArea</span></h2>
<p>GtkGLArea — A widget for custom drawing with OpenGL</p>
</td>
<td class="gallery_image" valign="top" align="right"><img src="glarea.png"></td>
</tr></table></div>
<div class="refsect1">
<a name="GtkGLArea.functions"></a><h2>Functions</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="functions_proto_type">
<col class="functions_proto_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<a class="link" href="GtkWidget.html" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *
</td>
<td class="function_name">
<a class="link" href="GtkGLArea.html#gtk-gl-area-new" title="gtk_gl_area_new ()">gtk_gl_area_new</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">GdkGLContext</span> *
</td>
<td class="function_name">
<a class="link" href="GtkGLArea.html#gtk-gl-area-get-context" title="gtk_gl_area_get_context ()">gtk_gl_area_get_context</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="GtkGLArea.html#gtk-gl-area-make-current" title="gtk_gl_area_make_current ()">gtk_gl_area_make_current</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="GtkGLArea.html#gtk-gl-area-queue-render" title="gtk_gl_area_queue_render ()">gtk_gl_area_queue_render</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="GtkGLArea.html#gtk-gl-area-attach-buffers" title="gtk_gl_area_attach_buffers ()">gtk_gl_area_attach_buffers</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="GtkGLArea.html#gtk-gl-area-set-error" title="gtk_gl_area_set_error ()">gtk_gl_area_set_error</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">GError</span> *
</td>
<td class="function_name">
<a class="link" href="GtkGLArea.html#gtk-gl-area-get-error" title="gtk_gl_area_get_error ()">gtk_gl_area_get_error</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="GtkGLArea.html#gtk-gl-area-set-has-alpha" title="gtk_gl_area_set_has_alpha ()">gtk_gl_area_set_has_alpha</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gboolean</span>
</td>
<td class="function_name">
<a class="link" href="GtkGLArea.html#gtk-gl-area-get-has-alpha" title="gtk_gl_area_get_has_alpha ()">gtk_gl_area_get_has_alpha</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="GtkGLArea.html#gtk-gl-area-set-has-depth-buffer" title="gtk_gl_area_set_has_depth_buffer ()">gtk_gl_area_set_has_depth_buffer</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gboolean</span>
</td>
<td class="function_name">
<a class="link" href="GtkGLArea.html#gtk-gl-area-get-has-depth-buffer" title="gtk_gl_area_get_has_depth_buffer ()">gtk_gl_area_get_has_depth_buffer</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="GtkGLArea.html#gtk-gl-area-set-has-stencil-buffer" title="gtk_gl_area_set_has_stencil_buffer ()">gtk_gl_area_set_has_stencil_buffer</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gboolean</span>
</td>
<td class="function_name">
<a class="link" href="GtkGLArea.html#gtk-gl-area-get-has-stencil-buffer" title="gtk_gl_area_get_has_stencil_buffer ()">gtk_gl_area_get_has_stencil_buffer</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="GtkGLArea.html#gtk-gl-area-set-auto-render" title="gtk_gl_area_set_auto_render ()">gtk_gl_area_set_auto_render</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gboolean</span>
</td>
<td class="function_name">
<a class="link" href="GtkGLArea.html#gtk-gl-area-get-auto-render" title="gtk_gl_area_get_auto_render ()">gtk_gl_area_get_auto_render</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="GtkGLArea.html#gtk-gl-area-get-required-version" title="gtk_gl_area_get_required_version ()">gtk_gl_area_get_required_version</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="GtkGLArea.html#gtk-gl-area-set-required-version" title="gtk_gl_area_set_required_version ()">gtk_gl_area_set_required_version</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="GtkGLArea.html#gtk-gl-area-set-use-es" title="gtk_gl_area_set_use_es ()">gtk_gl_area_set_use_es</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gboolean</span>
</td>
<td class="function_name">
<a class="link" href="GtkGLArea.html#gtk-gl-area-get-use-es" title="gtk_gl_area_get_use_es ()">gtk_gl_area_get_use_es</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GtkGLArea.properties"></a><h2>Properties</h2>
<div class="informaltable"><table class="informaltable" border="0">
<colgroup>
<col width="150px" class="properties_type">
<col width="300px" class="properties_name">
<col width="200px" class="properties_flags">
</colgroup>
<tbody>
<tr>
<td class="property_type"><span class="type">gboolean</span></td>
<td class="property_name"><a class="link" href="GtkGLArea.html#GtkGLArea--auto-render" title="The “auto-render” property">auto-render</a></td>
<td class="property_flags">Read / Write</td>
</tr>
<tr>
<td class="property_type">
<span class="type">GdkGLContext</span> *</td>
<td class="property_name"><a class="link" href="GtkGLArea.html#GtkGLArea--context" title="The “context” property">context</a></td>
<td class="property_flags">Read</td>
</tr>
<tr>
<td class="property_type"><span class="type">gboolean</span></td>
<td class="property_name"><a class="link" href="GtkGLArea.html#GtkGLArea--has-alpha" title="The “has-alpha” property">has-alpha</a></td>
<td class="property_flags">Read / Write</td>
</tr>
<tr>
<td class="property_type"><span class="type">gboolean</span></td>
<td class="property_name"><a class="link" href="GtkGLArea.html#GtkGLArea--has-depth-buffer" title="The “has-depth-buffer” property">has-depth-buffer</a></td>
<td class="property_flags">Read / Write</td>
</tr>
<tr>
<td class="property_type"><span class="type">gboolean</span></td>
<td class="property_name"><a class="link" href="GtkGLArea.html#GtkGLArea--has-stencil-buffer" title="The “has-stencil-buffer” property">has-stencil-buffer</a></td>
<td class="property_flags">Read / Write</td>
</tr>
<tr>
<td class="property_type"><span class="type">gboolean</span></td>
<td class="property_name"><a class="link" href="GtkGLArea.html#GtkGLArea--use-es" title="The “use-es” property">use-es</a></td>
<td class="property_flags">Read / Write</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GtkGLArea.signals"></a><h2>Signals</h2>
<div class="informaltable"><table class="informaltable" border="0">
<colgroup>
<col width="150px" class="signal_proto_type">
<col width="300px" class="signal_proto_name">
<col width="200px" class="signal_proto_flags">
</colgroup>
<tbody>
<tr>
<td class="signal_type">
<span class="returnvalue">GdkGLContext</span>*</td>
<td class="signal_name"><a class="link" href="GtkGLArea.html#GtkGLArea-create-context" title="The “create-context” signal">create-context</a></td>
<td class="signal_flags">Run Last</td>
</tr>
<tr>
<td class="signal_type"><span class="returnvalue">gboolean</span></td>
<td class="signal_name"><a class="link" href="GtkGLArea.html#GtkGLArea-render" title="The “render” signal">render</a></td>
<td class="signal_flags">Run Last</td>
</tr>
<tr>
<td class="signal_type"><span class="returnvalue">void</span></td>
<td class="signal_name"><a class="link" href="GtkGLArea.html#GtkGLArea-resize" title="The “resize” signal">resize</a></td>
<td class="signal_flags">Run Last</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GtkGLArea.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="other_proto_type">
<col class="other_proto_name">
</colgroup>
<tbody>
<tr>
<td class="datatype_keyword">struct</td>
<td class="function_name"><a class="link" href="GtkGLArea.html#GtkGLArea-struct" title="struct GtkGLArea">GtkGLArea</a></td>
</tr>
<tr>
<td class="datatype_keyword">struct</td>
<td class="function_name"><a class="link" href="GtkGLArea.html#GtkGLAreaClass" title="struct GtkGLAreaClass">GtkGLAreaClass</a></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GtkGLArea.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="screen">    GObject
    <span class="lineart">╰──</span> GInitiallyUnowned
        <span class="lineart">╰──</span> <a class="link" href="GtkWidget.html" title="GtkWidget">GtkWidget</a>
            <span class="lineart">╰──</span> GtkGLArea
</pre>
</div>
<div class="refsect1">
<a name="GtkGLArea.implemented-interfaces"></a><h2>Implemented Interfaces</h2>
<p>
GtkGLArea implements
 AtkImplementorIface and  <a class="link" href="GtkBuildable.html" title="GtkBuildable">GtkBuildable</a>.</p>
</div>
<div class="refsect1">
<a name="GtkGLArea.includes"></a><h2>Includes</h2>
<pre class="synopsis">#include &lt;gtk/gtk.h&gt;
</pre>
</div>
<div class="refsect1">
<a name="GtkGLArea.description"></a><h2>Description</h2>
<p><a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a> is a widget that allows drawing with OpenGL.</p>
<p><a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a> sets up its own <span class="type">GdkGLContext</span> for the window it creates, and
creates a custom GL framebuffer that the widget will do GL rendering onto.
It also ensures that this framebuffer is the default GL rendering target
when rendering.</p>
<p>In order to draw, you have to connect to the <a class="link" href="GtkGLArea.html#GtkGLArea-render" title="The “render” signal"><span class="type">“render”</span></a> signal,
or subclass <a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a> and override the <em class="parameter"><code>GtkGLAreaClass.render()</code></em>
 virtual
function.</p>
<p>The <a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a> widget ensures that the <span class="type">GdkGLContext</span> is associated with
the widget's drawing area, and it is kept updated when the size and
position of the drawing area changes.</p>
<div class="refsect3">
<a name="id-1.3.19.5.10.6"></a><h4>Drawing with GtkGLArea</h4>
<p>The simplest way to draw using OpenGL commands in a <a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a> is to
create a widget instance and connect to the <a class="link" href="GtkGLArea.html#GtkGLArea-render" title="The “render” signal"><span class="type">“render”</span></a> signal:</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4
5</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="c1">// create a GtkGLArea instance</span>
<span class="n">GtkWidget</span> <span class="o">*</span><span class="n">gl_area</span> <span class="o">=</span> <span class="n">gtk_gl_area_new</span> <span class="p">();</span>

<span class="c1">// connect to the &quot;render&quot; signal</span>
<span class="n">g_signal_connect</span> <span class="p">(</span><span class="n">gl_area</span><span class="p">,</span> <span class="s">&quot;render&quot;</span><span class="p">,</span> <span class="n">G_CALLBACK</span> <span class="p">(</span><span class="n">render</span><span class="p">),</span> <span class="nb">NULL</span><span class="p">);</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p></p>
<p>The <code class="literal"><code class="function">render()</code></code> function will be called when the <a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a> is ready
for you to draw its content:</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="k">static</span> <span class="n">gboolean</span>
<span class="n">render</span> <span class="p">(</span><span class="n">GtkGLArea</span> <span class="o">*</span><span class="n">area</span><span class="p">,</span> <span class="n">GdkGLContext</span> <span class="o">*</span><span class="n">context</span><span class="p">)</span>
<span class="p">{</span>
  <span class="c1">// inside this function it&#39;s safe to use GL; the given</span>
  <span class="c1">// #GdkGLContext has been made current to the drawable</span>
  <span class="c1">// surface used by the #GtkGLArea and the viewport has</span>
  <span class="c1">// already been set to be the size of the allocation</span>

  <span class="c1">// we can start by clearing the buffer</span>
  <span class="n">glClearColor</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">);</span>
  <span class="n">glClear</span> <span class="p">(</span><span class="n">GL_COLOR_BUFFER_BIT</span><span class="p">);</span>

  <span class="c1">// draw your object</span>
  <span class="n">draw_an_object</span> <span class="p">();</span>

  <span class="c1">// we completed our drawing; the draw commands will be</span>
  <span class="c1">// flushed at the end of the signal emission chain, and</span>
  <span class="c1">// the buffers will be drawn on the window</span>
  <span class="k">return</span> <span class="n">TRUE</span><span class="p">;</span>
<span class="p">}</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p></p>
<p>If you need to initialize OpenGL state, e.g. buffer objects or
shaders, you should use the <a class="link" href="GtkWidget.html#GtkWidget-realize" title="The “realize” signal"><span class="type">“realize”</span></a> signal; you
can use the <a class="link" href="GtkWidget.html#GtkWidget-unrealize" title="The “unrealize” signal"><span class="type">“unrealize”</span></a> signal to clean up. Since the
<span class="type">GdkGLContext</span> creation and initialization may fail, you will
need to check for errors, using <a class="link" href="GtkGLArea.html#gtk-gl-area-get-error" title="gtk_gl_area_get_error ()"><code class="function">gtk_gl_area_get_error()</code></a>. An example
of how to safely initialize the GL state is:</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="k">static</span> <span class="kt">void</span>
<span class="n">on_realize</span> <span class="p">(</span><span class="n">GtkGLarea</span> <span class="o">*</span><span class="n">area</span><span class="p">)</span>
<span class="p">{</span>
  <span class="c1">// We need to make the context current if we want to</span>
  <span class="c1">// call GL API</span>
  <span class="n">gtk_gl_area_make_current</span> <span class="p">(</span><span class="n">area</span><span class="p">);</span>

  <span class="c1">// If there were errors during the initialization or</span>
  <span class="c1">// when trying to make the context current, this</span>
  <span class="c1">// function will return a #GError for you to catch</span>
  <span class="k">if</span> <span class="p">(</span><span class="n">gtk_gl_area_get_error</span> <span class="p">(</span><span class="n">area</span><span class="p">)</span> <span class="o">!=</span> <span class="nb">NULL</span><span class="p">)</span>
    <span class="k">return</span><span class="p">;</span>

  <span class="c1">// You can also use gtk_gl_area_set_error() in order</span>
  <span class="c1">// to show eventual initialization errors on the</span>
  <span class="c1">// GtkGLArea widget itself</span>
  <span class="n">GError</span> <span class="o">*</span><span class="n">internal_error</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
  <span class="n">init_buffer_objects</span> <span class="p">(</span><span class="o">&amp;</span><span class="n">error</span><span class="p">);</span>
  <span class="k">if</span> <span class="p">(</span><span class="n">error</span> <span class="o">!=</span> <span class="nb">NULL</span><span class="p">)</span>
    <span class="p">{</span>
      <span class="n">gtk_gl_area_set_error</span> <span class="p">(</span><span class="n">area</span><span class="p">,</span> <span class="n">error</span><span class="p">);</span>
      <span class="n">g_error_free</span> <span class="p">(</span><span class="n">error</span><span class="p">);</span>
      <span class="k">return</span><span class="p">;</span>
    <span class="p">}</span>

  <span class="n">init_shaders</span> <span class="p">(</span><span class="o">&amp;</span><span class="n">error</span><span class="p">);</span>
  <span class="k">if</span> <span class="p">(</span><span class="n">error</span> <span class="o">!=</span> <span class="nb">NULL</span><span class="p">)</span>
    <span class="p">{</span>
      <span class="n">gtk_gl_area_set_error</span> <span class="p">(</span><span class="n">area</span><span class="p">,</span> <span class="n">error</span><span class="p">);</span>
      <span class="n">g_error_free</span> <span class="p">(</span><span class="n">error</span><span class="p">);</span>
      <span class="k">return</span><span class="p">;</span>
    <span class="p">}</span>
<span class="p">}</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p></p>
<p>If you need to change the options for creating the <span class="type">GdkGLContext</span>
you should use the <a class="link" href="GtkGLArea.html#GtkGLArea-create-context" title="The “create-context” signal"><span class="type">“create-context”</span></a> signal.</p>
</div>
</div>
<div class="refsect1">
<a name="GtkGLArea.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="gtk-gl-area-new"></a><h3>gtk_gl_area_new ()</h3>
<pre class="programlisting"><a class="link" href="GtkWidget.html" title="GtkWidget"><span class="returnvalue">GtkWidget</span></a> *
gtk_gl_area_new (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>Creates a new <a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a> widget.</p>
<div class="refsect3">
<a name="gtk-gl-area-new.returns"></a><h4>Returns</h4>
<p> a new <a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a></p>
</div>
<p class="since">Since: <a class="link" href="api-index-3-16.html#api-index-3.16">3.16</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-gl-area-get-context"></a><h3>gtk_gl_area_get_context ()</h3>
<pre class="programlisting"><span class="returnvalue">GdkGLContext</span> *
gtk_gl_area_get_context (<em class="parameter"><code><a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a> *area</code></em>);</pre>
<p>Retrieves the <span class="type">GdkGLContext</span> used by <em class="parameter"><code>area</code></em>
.</p>
<div class="refsect3">
<a name="gtk-gl-area-get-context.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>area</p></td>
<td class="parameter_description"><p>a <a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gtk-gl-area-get-context.returns"></a><h4>Returns</h4>
<p>the <span class="type">GdkGLContext</span>. </p>
<p><span class="annotation">[<acronym title="The data is owned by the callee, which is responsible of freeing it."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-3-16.html#api-index-3.16">3.16</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-gl-area-make-current"></a><h3>gtk_gl_area_make_current ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gtk_gl_area_make_current (<em class="parameter"><code><a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a> *area</code></em>);</pre>
<p>Ensures that the <span class="type">GdkGLContext</span> used by <em class="parameter"><code>area</code></em>
 is associated with
the <a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a>.</p>
<p>This function is automatically called before emitting the
<a class="link" href="GtkGLArea.html#GtkGLArea-render" title="The “render” signal"><span class="type">“render”</span></a> signal, and doesn't normally need to be called
by application code.</p>
<div class="refsect3">
<a name="gtk-gl-area-make-current.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>area</p></td>
<td class="parameter_description"><p>a <a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-3-16.html#api-index-3.16">3.16</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-gl-area-queue-render"></a><h3>gtk_gl_area_queue_render ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gtk_gl_area_queue_render (<em class="parameter"><code><a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a> *area</code></em>);</pre>
<p>Marks the currently rendered data (if any) as invalid, and queues
a redraw of the widget, ensuring that the <a class="link" href="GtkGLArea.html#GtkGLArea-render" title="The “render” signal"><span class="type">“render”</span></a> signal
is emitted during the draw.</p>
<p>This is only needed when the <a class="link" href="GtkGLArea.html#gtk-gl-area-set-auto-render" title="gtk_gl_area_set_auto_render ()"><code class="function">gtk_gl_area_set_auto_render()</code></a> has
been called with a <code class="literal">FALSE</code> value. The default behaviour is to
emit <a class="link" href="GtkGLArea.html#GtkGLArea-render" title="The “render” signal"><span class="type">“render”</span></a> on each draw.</p>
<div class="refsect3">
<a name="gtk-gl-area-queue-render.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>area</p></td>
<td class="parameter_description"><p>a <a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-3-16.html#api-index-3.16">3.16</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-gl-area-attach-buffers"></a><h3>gtk_gl_area_attach_buffers ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gtk_gl_area_attach_buffers (<em class="parameter"><code><a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a> *area</code></em>);</pre>
<p>Ensures that the <em class="parameter"><code>area</code></em>
 framebuffer object is made the current draw
and read target, and that all the required buffers for the <em class="parameter"><code>area</code></em>

are created and bound to the frambuffer.</p>
<p>This function is automatically called before emitting the
<a class="link" href="GtkGLArea.html#GtkGLArea-render" title="The “render” signal"><span class="type">“render”</span></a> signal, and doesn't normally need to be called
by application code.</p>
<div class="refsect3">
<a name="gtk-gl-area-attach-buffers.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>area</p></td>
<td class="parameter_description"><p>a <a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-3-16.html#api-index-3.16">3.16</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-gl-area-set-error"></a><h3>gtk_gl_area_set_error ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gtk_gl_area_set_error (<em class="parameter"><code><a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a> *area</code></em>,
                       <em class="parameter"><code>const <span class="type">GError</span> *error</code></em>);</pre>
<p>Sets an error on the area which will be shown instead of the
GL rendering. This is useful in the <a class="link" href="GtkGLArea.html#GtkGLArea-create-context" title="The “create-context” signal"><span class="type">“create-context”</span></a>
signal if GL context creation fails.</p>
<div class="refsect3">
<a name="gtk-gl-area-set-error.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>area</p></td>
<td class="parameter_description"><p>a <a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>a new <span class="type">GError</span>, or <code class="literal">NULL</code> to unset the error. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-3-16.html#api-index-3.16">3.16</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-gl-area-get-error"></a><h3>gtk_gl_area_get_error ()</h3>
<pre class="programlisting"><span class="returnvalue">GError</span> *
gtk_gl_area_get_error (<em class="parameter"><code><a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a> *area</code></em>);</pre>
<p>Gets the current error set on the <em class="parameter"><code>area</code></em>
.</p>
<div class="refsect3">
<a name="gtk-gl-area-get-error.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>area</p></td>
<td class="parameter_description"><p>a <a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gtk-gl-area-get-error.returns"></a><h4>Returns</h4>
<p>the <span class="type">GError</span> or <code class="literal">NULL</code>. </p>
<p><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>][<acronym title="The data is owned by the callee, which is responsible of freeing it."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-3-16.html#api-index-3.16">3.16</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-gl-area-set-has-alpha"></a><h3>gtk_gl_area_set_has_alpha ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gtk_gl_area_set_has_alpha (<em class="parameter"><code><a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a> *area</code></em>,
                           <em class="parameter"><code><span class="type">gboolean</span> has_alpha</code></em>);</pre>
<p>If <em class="parameter"><code>has_alpha</code></em>
 is <code class="literal">TRUE</code> the buffer allocated by the widget will have
an alpha channel component, and when rendering to the window the
result will be composited over whatever is below the widget.</p>
<p>If <em class="parameter"><code>has_alpha</code></em>
 is <code class="literal">FALSE</code> there will be no alpha channel, and the
buffer will fully replace anything below the widget.</p>
<div class="refsect3">
<a name="gtk-gl-area-set-has-alpha.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>area</p></td>
<td class="parameter_description"><p>a <a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>has_alpha</p></td>
<td class="parameter_description"><p><code class="literal">TRUE</code> to add an alpha component</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-3-16.html#api-index-3.16">3.16</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-gl-area-get-has-alpha"></a><h3>gtk_gl_area_get_has_alpha ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
gtk_gl_area_get_has_alpha (<em class="parameter"><code><a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a> *area</code></em>);</pre>
<p>Returns whether the area has an alpha component.</p>
<div class="refsect3">
<a name="gtk-gl-area-get-has-alpha.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>area</p></td>
<td class="parameter_description"><p>a <a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gtk-gl-area-get-has-alpha.returns"></a><h4>Returns</h4>
<p> <code class="literal">TRUE</code> if the <em class="parameter"><code>area</code></em>
has an alpha component, <code class="literal">FALSE</code> otherwise</p>
</div>
<p class="since">Since: <a class="link" href="api-index-3-16.html#api-index-3.16">3.16</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-gl-area-set-has-depth-buffer"></a><h3>gtk_gl_area_set_has_depth_buffer ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gtk_gl_area_set_has_depth_buffer (<em class="parameter"><code><a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a> *area</code></em>,
                                  <em class="parameter"><code><span class="type">gboolean</span> has_depth_buffer</code></em>);</pre>
<p>If <em class="parameter"><code>has_depth_buffer</code></em>
 is <code class="literal">TRUE</code> the widget will allocate and
enable a depth buffer for the target framebuffer. Otherwise
there will be none.</p>
<div class="refsect3">
<a name="gtk-gl-area-set-has-depth-buffer.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>area</p></td>
<td class="parameter_description"><p>a <a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>has_depth_buffer</p></td>
<td class="parameter_description"><p><code class="literal">TRUE</code> to add a depth buffer</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-3-16.html#api-index-3.16">3.16</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-gl-area-get-has-depth-buffer"></a><h3>gtk_gl_area_get_has_depth_buffer ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
gtk_gl_area_get_has_depth_buffer (<em class="parameter"><code><a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a> *area</code></em>);</pre>
<p>Returns whether the area has a depth buffer.</p>
<div class="refsect3">
<a name="gtk-gl-area-get-has-depth-buffer.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>area</p></td>
<td class="parameter_description"><p>a <a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gtk-gl-area-get-has-depth-buffer.returns"></a><h4>Returns</h4>
<p> <code class="literal">TRUE</code> if the <em class="parameter"><code>area</code></em>
has a depth buffer, <code class="literal">FALSE</code> otherwise</p>
</div>
<p class="since">Since: <a class="link" href="api-index-3-16.html#api-index-3.16">3.16</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-gl-area-set-has-stencil-buffer"></a><h3>gtk_gl_area_set_has_stencil_buffer ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gtk_gl_area_set_has_stencil_buffer (<em class="parameter"><code><a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a> *area</code></em>,
                                    <em class="parameter"><code><span class="type">gboolean</span> has_stencil_buffer</code></em>);</pre>
<p>If <em class="parameter"><code>has_stencil_buffer</code></em>
 is <code class="literal">TRUE</code> the widget will allocate and
enable a stencil buffer for the target framebuffer. Otherwise
there will be none.</p>
<div class="refsect3">
<a name="gtk-gl-area-set-has-stencil-buffer.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>area</p></td>
<td class="parameter_description"><p>a <a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>has_stencil_buffer</p></td>
<td class="parameter_description"><p><code class="literal">TRUE</code> to add a stencil buffer</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-3-16.html#api-index-3.16">3.16</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-gl-area-get-has-stencil-buffer"></a><h3>gtk_gl_area_get_has_stencil_buffer ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
gtk_gl_area_get_has_stencil_buffer (<em class="parameter"><code><a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a> *area</code></em>);</pre>
<p>Returns whether the area has a stencil buffer.</p>
<div class="refsect3">
<a name="gtk-gl-area-get-has-stencil-buffer.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>area</p></td>
<td class="parameter_description"><p>a <a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gtk-gl-area-get-has-stencil-buffer.returns"></a><h4>Returns</h4>
<p> <code class="literal">TRUE</code> if the <em class="parameter"><code>area</code></em>
has a stencil buffer, <code class="literal">FALSE</code> otherwise</p>
</div>
<p class="since">Since: <a class="link" href="api-index-3-16.html#api-index-3.16">3.16</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-gl-area-set-auto-render"></a><h3>gtk_gl_area_set_auto_render ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gtk_gl_area_set_auto_render (<em class="parameter"><code><a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a> *area</code></em>,
                             <em class="parameter"><code><span class="type">gboolean</span> auto_render</code></em>);</pre>
<p>If <em class="parameter"><code>auto_render</code></em>
 is <code class="literal">TRUE</code> the <a class="link" href="GtkGLArea.html#GtkGLArea-render" title="The “render” signal"><span class="type">“render”</span></a> signal will be
emitted every time the widget draws. This is the default and is
useful if drawing the widget is faster.</p>
<p>If <em class="parameter"><code>auto_render</code></em>
 is <code class="literal">FALSE</code> the data from previous rendering is kept
around and will be used for drawing the widget the next time,
unless the window is resized. In order to force a rendering
<a class="link" href="GtkGLArea.html#gtk-gl-area-queue-render" title="gtk_gl_area_queue_render ()"><code class="function">gtk_gl_area_queue_render()</code></a> must be called. This mode is useful when
the scene changes seldomly, but takes a long time to redraw.</p>
<div class="refsect3">
<a name="gtk-gl-area-set-auto-render.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>area</p></td>
<td class="parameter_description"><p>a <a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>auto_render</p></td>
<td class="parameter_description"><p>a boolean</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-3-16.html#api-index-3.16">3.16</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-gl-area-get-auto-render"></a><h3>gtk_gl_area_get_auto_render ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
gtk_gl_area_get_auto_render (<em class="parameter"><code><a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a> *area</code></em>);</pre>
<p>Returns whether the area is in auto render mode or not.</p>
<div class="refsect3">
<a name="gtk-gl-area-get-auto-render.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>area</p></td>
<td class="parameter_description"><p>a <a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gtk-gl-area-get-auto-render.returns"></a><h4>Returns</h4>
<p> <code class="literal">TRUE</code> if the <em class="parameter"><code>area</code></em>
is auto rendering, <code class="literal">FALSE</code> otherwise</p>
</div>
<p class="since">Since: <a class="link" href="api-index-3-16.html#api-index-3.16">3.16</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-gl-area-get-required-version"></a><h3>gtk_gl_area_get_required_version ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gtk_gl_area_get_required_version (<em class="parameter"><code><a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a> *area</code></em>,
                                  <em class="parameter"><code><span class="type">gint</span> *major</code></em>,
                                  <em class="parameter"><code><span class="type">gint</span> *minor</code></em>);</pre>
<p>Retrieves the required version of OpenGL set
using <a class="link" href="GtkGLArea.html#gtk-gl-area-set-required-version" title="gtk_gl_area_set_required_version ()"><code class="function">gtk_gl_area_set_required_version()</code></a>.</p>
<div class="refsect3">
<a name="gtk-gl-area-get-required-version.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>area</p></td>
<td class="parameter_description"><p>a <a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>major</p></td>
<td class="parameter_description"><p>return location for the required major version. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>minor</p></td>
<td class="parameter_description"><p>return location for the required minor version. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-3-16.html#api-index-3.16">3.16</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-gl-area-set-required-version"></a><h3>gtk_gl_area_set_required_version ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gtk_gl_area_set_required_version (<em class="parameter"><code><a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a> *area</code></em>,
                                  <em class="parameter"><code><span class="type">gint</span> major</code></em>,
                                  <em class="parameter"><code><span class="type">gint</span> minor</code></em>);</pre>
<p>Sets the required version of OpenGL to be used when creating the context
for the widget.</p>
<p>This function must be called before the area has been realized.</p>
<div class="refsect3">
<a name="gtk-gl-area-set-required-version.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>area</p></td>
<td class="parameter_description"><p>a <a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>major</p></td>
<td class="parameter_description"><p>the major version</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>minor</p></td>
<td class="parameter_description"><p>the minor version</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-3-16.html#api-index-3.16">3.16</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-gl-area-set-use-es"></a><h3>gtk_gl_area_set_use_es ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gtk_gl_area_set_use_es (<em class="parameter"><code><a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a> *area</code></em>,
                        <em class="parameter"><code><span class="type">gboolean</span> use_es</code></em>);</pre>
<p>Sets whether the <em class="parameter"><code>area</code></em>
 should create an OpenGL or an OpenGL ES context.</p>
<p>You should check the capabilities of the <span class="type">GdkGLContext</span> before drawing
with either API.</p>
<div class="refsect3">
<a name="gtk-gl-area-set-use-es.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>area</p></td>
<td class="parameter_description"><p>a <a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>use_es</p></td>
<td class="parameter_description"><p>whether to use OpenGL or OpenGL ES</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-3-22.html#api-index-3.22">3.22</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-gl-area-get-use-es"></a><h3>gtk_gl_area_get_use_es ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
gtk_gl_area_get_use_es (<em class="parameter"><code><a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a> *area</code></em>);</pre>
<p>Retrieves the value set by <a class="link" href="GtkGLArea.html#gtk-gl-area-set-use-es" title="gtk_gl_area_set_use_es ()"><code class="function">gtk_gl_area_set_use_es()</code></a>.</p>
<div class="refsect3">
<a name="gtk-gl-area-get-use-es.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>area</p></td>
<td class="parameter_description"><p>a <a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gtk-gl-area-get-use-es.returns"></a><h4>Returns</h4>
<p> <code class="literal">TRUE</code> if the <a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a> should create an OpenGL ES context
and <code class="literal">FALSE</code> otherwise</p>
</div>
<p class="since">Since: <a class="link" href="api-index-3-22.html#api-index-3.22">3.22</a></p>
</div>
</div>
<div class="refsect1">
<a name="GtkGLArea.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="GtkGLArea-struct"></a><h3>struct GtkGLArea</h3>
<pre class="programlisting">struct GtkGLArea;</pre>
<p>A <a class="link" href="GtkWidget.html" title="GtkWidget"><span class="type">GtkWidget</span></a> used for drawing with OpenGL.</p>
<p class="since">Since: <a class="link" href="api-index-3-16.html#api-index-3.16">3.16</a></p>
</div>
<hr>
<div class="refsect2">
<a name="GtkGLAreaClass"></a><h3>struct GtkGLAreaClass</h3>
<pre class="programlisting">struct GtkGLAreaClass {
  gboolean       (* render)         (GtkGLArea        *area,
                                     GdkGLContext     *context);
  void           (* resize)         (GtkGLArea        *area,
                                     int               width,
                                     int               height);
  GdkGLContext * (* create_context) (GtkGLArea        *area);
};
</pre>
<p>The <code class="literal">GtkGLAreaClass</code> structure contains only private data.</p>
<div class="refsect3">
<a name="GtkGLAreaClass.members"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="300px" class="struct_members_name">
<col class="struct_members_description">
<col width="200px" class="struct_members_annotations">
</colgroup>
<tbody>
<tr>
<td class="struct_member_name"><p><em class="structfield"><code><a name="GtkGLAreaClass.render"></a>render</code></em> ()</p></td>
<td class="struct_member_description"><p>class closure for the <a class="link" href="GtkGLArea.html#GtkGLArea-render" title="The “render” signal"><span class="type">“render”</span></a> signal</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><em class="structfield"><code><a name="GtkGLAreaClass.resize"></a>resize</code></em> ()</p></td>
<td class="struct_member_description"><p>class closeure for the <a class="link" href="GtkGLArea.html#GtkGLArea-resize" title="The “resize” signal"><span class="type">“resize”</span></a> signal</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><em class="structfield"><code><a name="GtkGLAreaClass.create-context"></a>create_context</code></em> ()</p></td>
<td class="struct_member_description"><p>class closure for the <a class="link" href="GtkGLArea.html#GtkGLArea-create-context" title="The “create-context” signal"><span class="type">“create-context”</span></a> signal</p></td>
<td class="struct_member_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-3-16.html#api-index-3.16">3.16</a></p>
</div>
</div>
<div class="refsect1">
<a name="GtkGLArea.property-details"></a><h2>Property Details</h2>
<div class="refsect2">
<a name="GtkGLArea--auto-render"></a><h3>The <code class="literal">“auto-render”</code> property</h3>
<pre class="programlisting">  “auto-render”              <span class="type">gboolean</span></pre>
<p>If set to <code class="literal">TRUE</code> the <a class="link" href="GtkGLArea.html#GtkGLArea-render" title="The “render” signal"><span class="type">“render”</span></a> signal will be emitted every time
the widget draws. This is the default and is useful if drawing the widget
is faster.</p>
<p>If set to <code class="literal">FALSE</code> the data from previous rendering is kept around and will
be used for drawing the widget the next time, unless the window is resized.
In order to force a rendering <a class="link" href="GtkGLArea.html#gtk-gl-area-queue-render" title="gtk_gl_area_queue_render ()"><code class="function">gtk_gl_area_queue_render()</code></a> must be called.
This mode is useful when the scene changes seldomly, but takes a long time
to redraw.</p>
<p>Owner: GtkGLArea</p>
<p>Flags: Read / Write</p>
<p>Default value: TRUE</p>
<p class="since">Since: <a class="link" href="api-index-3-16.html#api-index-3.16">3.16</a></p>
</div>
<hr>
<div class="refsect2">
<a name="GtkGLArea--context"></a><h3>The <code class="literal">“context”</code> property</h3>
<pre class="programlisting">  “context”                  <span class="type">GdkGLContext</span> *</pre>
<p>The <span class="type">GdkGLContext</span> used by the <a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a> widget.</p>
<p>The <a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a> widget is responsible for creating the <span class="type">GdkGLContext</span>
instance. If you need to render with other kinds of buffers (stencil,
depth, etc), use render buffers.</p>
<p>Owner: GtkGLArea</p>
<p>Flags: Read</p>
<p class="since">Since: <a class="link" href="api-index-3-16.html#api-index-3.16">3.16</a></p>
</div>
<hr>
<div class="refsect2">
<a name="GtkGLArea--has-alpha"></a><h3>The <code class="literal">“has-alpha”</code> property</h3>
<pre class="programlisting">  “has-alpha”                <span class="type">gboolean</span></pre>
<p>If set to <code class="literal">TRUE</code> the buffer allocated by the widget will have an alpha channel
component, and when rendering to the window the result will be composited over
whatever is below the widget.</p>
<p>If set to <code class="literal">FALSE</code> there will be no alpha channel, and the buffer will fully
replace anything below the widget.</p>
<p>Owner: GtkGLArea</p>
<p>Flags: Read / Write</p>
<p>Default value: FALSE</p>
<p class="since">Since: <a class="link" href="api-index-3-16.html#api-index-3.16">3.16</a></p>
</div>
<hr>
<div class="refsect2">
<a name="GtkGLArea--has-depth-buffer"></a><h3>The <code class="literal">“has-depth-buffer”</code> property</h3>
<pre class="programlisting">  “has-depth-buffer”         <span class="type">gboolean</span></pre>
<p>If set to <code class="literal">TRUE</code> the widget will allocate and enable a depth buffer for the
target framebuffer.</p>
<p>Owner: GtkGLArea</p>
<p>Flags: Read / Write</p>
<p>Default value: FALSE</p>
<p class="since">Since: <a class="link" href="api-index-3-16.html#api-index-3.16">3.16</a></p>
</div>
<hr>
<div class="refsect2">
<a name="GtkGLArea--has-stencil-buffer"></a><h3>The <code class="literal">“has-stencil-buffer”</code> property</h3>
<pre class="programlisting">  “has-stencil-buffer”       <span class="type">gboolean</span></pre>
<p>If set to <code class="literal">TRUE</code> the widget will allocate and enable a stencil buffer for the
target framebuffer.</p>
<p>Owner: GtkGLArea</p>
<p>Flags: Read / Write</p>
<p>Default value: FALSE</p>
<p class="since">Since: <a class="link" href="api-index-3-16.html#api-index-3.16">3.16</a></p>
</div>
<hr>
<div class="refsect2">
<a name="GtkGLArea--use-es"></a><h3>The <code class="literal">“use-es”</code> property</h3>
<pre class="programlisting">  “use-es”                   <span class="type">gboolean</span></pre>
<p>If set to <code class="literal">TRUE</code> the widget will try to create a <span class="type">GdkGLContext</span> using
OpenGL ES instead of OpenGL.</p>
<p>See also: <code class="function">gdk_gl_context_set_use_es()</code></p>
<p>Owner: GtkGLArea</p>
<p>Flags: Read / Write</p>
<p>Default value: FALSE</p>
<p class="since">Since: <a class="link" href="api-index-3-22.html#api-index-3.22">3.22</a></p>
</div>
</div>
<div class="refsect1">
<a name="GtkGLArea.signal-details"></a><h2>Signal Details</h2>
<div class="refsect2">
<a name="GtkGLArea-create-context"></a><h3>The <code class="literal">“create-context”</code> signal</h3>
<pre class="programlisting"><span class="returnvalue">GdkGLContext</span>*
user_function (<a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a> *area,
               <span class="type">gpointer</span>   user_data)</pre>
<p>The ::create-context signal is emitted when the widget is being
realized, and allows you to override how the GL context is
created. This is useful when you want to reuse an existing GL
context, or if you want to try creating different kinds of GL
options.</p>
<p>If context creation fails then the signal handler can use
<a class="link" href="GtkGLArea.html#gtk-gl-area-set-error" title="gtk_gl_area_set_error ()"><code class="function">gtk_gl_area_set_error()</code></a> to register a more detailed error
of how the construction failed.</p>
<div class="refsect3">
<a name="GtkGLArea-create-context.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>area</p></td>
<td class="parameter_description"><p>the <a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a> that emitted the signal</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>location to store error information on failure. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>user_data</p></td>
<td class="parameter_description"><p>user data set when the signal handler was connected.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="GtkGLArea-create-context.returns"></a><h4>Returns</h4>
<p>a newly created <span class="type">GdkGLContext</span>;
the <a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a> widget will take ownership of the returned value. </p>
<p><span class="annotation">[<acronym title="The caller owns the data, and is responsible for free it."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p>Flags: Run Last</p>
<p class="since">Since: <a class="link" href="api-index-3-16.html#api-index-3.16">3.16</a></p>
</div>
<hr>
<div class="refsect2">
<a name="GtkGLArea-render"></a><h3>The <code class="literal">“render”</code> signal</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
user_function (<a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a>    *area,
               <span class="type">GdkGLContext</span> *context,
               <span class="type">gpointer</span>      user_data)</pre>
<p>The ::render signal is emitted every time the contents
of the <a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a> should be redrawn.</p>
<p>The <em class="parameter"><code>context</code></em>
 is bound to the <em class="parameter"><code>area</code></em>
 prior to emitting this function,
and the buffers are painted to the window once the emission terminates.</p>
<div class="refsect3">
<a name="GtkGLArea-render.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>area</p></td>
<td class="parameter_description"><p>the <a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a> that emitted the signal</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>context</p></td>
<td class="parameter_description"><p>the <span class="type">GdkGLContext</span> used by <em class="parameter"><code>area</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>user_data</p></td>
<td class="parameter_description"><p>user data set when the signal handler was connected.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="GtkGLArea-render.returns"></a><h4>Returns</h4>
<p> <code class="literal">TRUE</code> to stop other handlers from being invoked for the event.
<code class="literal">FALSE</code> to propagate the event further.</p>
</div>
<p>Flags: Run Last</p>
<p class="since">Since: <a class="link" href="api-index-3-16.html#api-index-3.16">3.16</a></p>
</div>
<hr>
<div class="refsect2">
<a name="GtkGLArea-resize"></a><h3>The <code class="literal">“resize”</code> signal</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
user_function (<a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a> *area,
               <span class="type">int</span>        width,
               <span class="type">int</span>        height,
               <span class="type">gpointer</span>   user_data)</pre>
<p>The ::resize signal is emitted once when the widget is realized, and
then each time the widget is changed while realized. This is useful
in order to keep GL state up to date with the widget size, like for
instance camera properties which may depend on the width/height ratio.</p>
<p>The GL context for the area is guaranteed to be current when this signal
is emitted.</p>
<p>The default handler sets up the GL viewport.</p>
<div class="refsect3">
<a name="GtkGLArea-resize.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>area</p></td>
<td class="parameter_description"><p>the <a class="link" href="GtkGLArea.html" title="GtkGLArea"><span class="type">GtkGLArea</span></a> that emitted the signal</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>width</p></td>
<td class="parameter_description"><p>the width of the viewport</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>height</p></td>
<td class="parameter_description"><p>the height of the viewport</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>user_data</p></td>
<td class="parameter_description"><p>user data set when the signal handler was connected.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p>Flags: Run Last</p>
<p class="since">Since: <a class="link" href="api-index-3-16.html#api-index-3.16">3.16</a></p>
</div>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.33.1</div>
</body>
</html>